<!DOCTYPE html>
<?php

require_once ('conn.php');
require_once ('top.php');
if($_SESSION['role']==1){
      Header("Location:index.php"); 
    }elseif($_SESSION['role']==3){
           Header("Location:dotlistMaster.php"); 
   }
$iid = $_GET['id'];
$ci_contact = mysql_fetch_row(mysql_query("select id,name from ci_contact where number ='$contactNumber'"));
?>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>优易购</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link rel="stylesheet" href="css/jquery.lineProgressbar.css">
    <script src="js/jquery-1.11.0.min.js"></script>
    <script src="js/jquery.lineProgressbar.js"></script>
</head>
<body>
    <div class="top">
        <span onclick="javascript:history.go(-1);" class="fanhui">返回</span>
        <span><?=$ci_contact[1]?></span>
        <div class="tright"><span class="outlogin">退出登陆</span></div>
    </div>
    
    <?php
    $result=mysql_query("select * from ci_invoice_info where iid='$iid' "); 
    $i=0;
    $but=0;
    while($row=mysql_fetch_array($result)) 
    {
        $total=$row['maxStorage'];
        $num = $row['amount'] / $row['price'];
        $num = $num - 0;
        $but = $but + $num;
        $good = mysql_fetch_row(mysql_query("select id,name from ci_goods where id='".$row['invId']."' "));
        $goodimg = mysql_fetch_row(mysql_query("select url from ci_goods_img where invId=$good[0] "));
        $img ="img/goods.png";

        if($goodimg[0]!=""){
              $img = $goodimg[0];
        }
    ?>
    <div class="list3">
        <div class="list100">
            <div class="goods">
                <img src="<?=$img?>" alt="">
                <span class="goodname"><?=$good[1]?></span><br>
                <span class="goodnum">需补货数量：<?=$num?></span>

               
            </div>
        </div>
    </div>
   <?php
    }
    ?>
    
    <div style=" width:100%;height:100px; float:left;"></div>
    
            <?php if($but>0){?>
                
                   <div class="goodsfootbut" id="buhuo" onclick="buhuo(<?=$iid?>)">
                   全部补货
                   </div>

             <?php  }else{?>
       
               <div class="goodsfootbuthui">全部补货</div>
                <?php }?>
    
     
    
</body>
<script src="js/outlogin.js"></script>
<script>
function buhuo(id){
 if(!confirm("是否确认补货？")){ 
 return false; 
} 
 $.post("ajaxbuhuook.php",{id:id},function(data) {
  if(data=="y"){
      alert('补货成功');
      window.location.replace("supply.php");
  }						
 });
}
</script>
	
</html>